local function Fn()
    local Fx = Class()


    function Fx:Init(NPC_BASE_LIB)
        ---------------------------------------------------------------------------------------------------------------------------

        function NPC_BASE_LIB:RPC_PushEvent(inst,event_name,data)
            if type(inst) == "string" then  ----- 如果参数弄错了，
                data = event_name
                event_name = inst
                inst = self.inst    
            end
            for k, player in pairs(AllPlayers) do
                SendModRPCToClient(CLIENT_MOD_RPC["NPC_RPC_SYSTEM"]["PushEvent"],player.userid,inst,event_name,json.encode(data))
            end
        end

        function NPC_BASE_LIB:RPC_AddTags(tags)
            if type(tags) ~= "table" then
                return
            end
            local inst = self.inst
            for k, v in pairs(tags) do
                if v and type(v) == "string" then
                    inst:AddTag(v)
                end
            end
            SendModRPCToClient(CLIENT_MOD_RPC["NPC_RPC_SYSTEM"]["AddTags"],inst.userid,inst,json.encode(tags))
        end

        function NPC_BASE_LIB:RPC_RemoveTags(tags)
            if type(tags) ~= "table" then
                return
            end
            local inst = self.inst
            for k, v in pairs(tags) do
                if v and type(v) == "string" then
                    inst:RemoveTag(v)
                end
            end
            SendModRPCToClient(CLIENT_MOD_RPC["NPC_RPC_SYSTEM"]["RemoveTags"],inst.userid,inst,json.encode(tags))
        end

        function NPC_BASE_LIB:RPC_ChangeTags(tags_cmd)
            --------------------------------------------------------------
                -- tags_cmd = {
                --     Add = {"tag1","tag2","tag3"},
                --     Remove = {"tag4","tag5"}
                -- }
            --------------------------------------------------------------
            if tags_cmd == nil then
                return
            end
            if tags_cmd.Add == nil and tags_cmd.Remove == nil then
                return
            end

            if tags_cmd.Add and type(tags_cmd.Add) ~= "table" then
                return
            end
            if tags_cmd.Remove and type(tags_cmd.Remove) ~= "table" then
                return
            end

            local inst = self.inst
            if tags_cmd.Add and type(tags_cmd.Add) == "table" then
                for k, v in pairs(tags_cmd.Add) do
                    inst:AddTag(v)
                end
            end
            
            if tags_cmd.Remove and type(tags_cmd.Remove) == "table" then
                for k, v in pairs(tags_cmd.Remove) do
                    inst:RemoveTag(v)
                end
            end

            SendModRPCToClient(CLIENT_MOD_RPC["NPC_RPC_SYSTEM"]["ChangeTags"],inst.userid,inst,json.encode(tags_cmd))

        end

        function NPC_BASE_LIB:RPC_World_PushEvent(event_name,data)
            SendModRPCToShard(SHARD_MOD_RPC["NPC_RPC_SYSTEM"]["World_Event_Through_The_Cave"], nil ,event_name,data ~= nil and json.encode(data))	--- shardId 直接为nil就可以跨洞穴执行
        end
        ---------------------------------------------------------------------------------------------------------------------------
    end

    return Fx
end

return Fn